<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>

<s:layout-render name="/frontend/layout.jsp" title="frontend.bookRoom.title">
    <s:layout-component name="body">
        <s:useActionBean beanclass="cz.muni.fi.pa165.bookingmanager.web.FrontEndActionBean" var="actionBean"/>
        <div class="content_right_section">        	
            <div class="content_title_01"><f:message key="frontend.bookRoom.title" /></div>  
            
            <h2><f:message key="frontend.bookRoom.reservation_time" /></h2>
            <h3><f:message key="frontend.global.arrival" />: <c:out value="${param.startDate}" /></h3>
            <h3><f:message key="entities.reservation.duration" />: <c:out value="${param.duration}" /></h3>
            
            <hr />
            
            <h2><f:message key="frontend.bookRoom.selected_hotel" /></h2>
            <h3>${actionBean.hotel.name}</h3>
            <h3>${actionBean.hotel.adress}, ${actionBean.hotel.city}</h3>
            
            <hr />
            
            <h2><f:message key="frontend.bookRoom.selected_room" /></h2>
            <h3><f:message key="entities.room.room_Number" />: ${actionBean.room.roomNumber}</h3>
            <h3><f:message key="entities.room.capacity" />: ${actionBean.room.capacity}</h3>
            <h3><f:message key="entities.reservation.total_price" />: ${actionBean.room.price * param.duration}</h3>
            
            <hr />
            <br />
            <p><f:message key="frontend.bookRoom.fill_customers_info_text" /></p>
            
            <s:form action="/frontend/executeBooking" method="post">
                <s:hidden name="startDateRaw" value="${param.startDateRaw}" />
                <s:hidden name="hotel.id" value="${param.hotel.id}" />
                <s:hidden name="room.id" value="${param.room.id}" />
                <s:hidden name="duration" value="${param.duration}" />
                
                <s:errors globalErrorsOnly="true">
                    <s:errors-header><ul></s:errors-header>
                    <li><s:individual-error /></li>
                    <s:errors-footer></ul></s:errors-footer>
                </s:errors>
            <table width="100%"> 
                <c:forEach var="i" begin="0" end="${actionBean.room.capacity - 1}">
                <tr>
                   <td colspan="2"><br />${i + 1}. <th> <f:message key="frontend.bookRoom.customer" /></th>
                </tr>
                <tr>
                    <th><f:message key="entities.customer.first_name" /></th>
                    <td>
                        <s:text name="customers[${i}].firstName" />
                        <s:errors field="customers[${i}].firstName">
                            <s:errors-header><ul></s:errors-header>
                            <li><s:individual-error /></li>
                            <s:errors-footer></ul></s:errors-footer>
                        </s:errors>
                    </td>
                </tr>
                <tr>
                    <th><f:message key="entities.customer.surname" /></th>
                    <td>
                        <s:text name="customers[${i}].surName" />
                        <s:errors field="customers[${i}].surName">
                            <s:errors-header><ul></s:errors-header>
                            <li><s:individual-error /></li>
                            <s:errors-footer></ul></s:errors-footer>
                        </s:errors>
                    </td>
                </tr>
                <tr>
                    <th><f:message key="entities.customer.number_of_id_card" /></th>
                    <td>
                        <s:text name="customers[${i}].numberOfIdCard" />
                        <s:errors field="customers[${i}].numberOfIdCard">
                            <s:errors-header><ul></s:errors-header>
                            <li><s:individual-error /></li>
                            <s:errors-footer></ul></s:errors-footer>
                        </s:errors>
                    </td>
                </tr>  
                </c:forEach>
                <tr>
                    <th colspan="2"><br /><s:submit name="executeBooking" ><f:message key="global.submit" /></s:submit></th>
                </tr>
            </table>
            </s:form>
       	</div>
        <div class="cleaner_h40">&nbsp;</div>
        
        
    </s:layout-component>
</s:layout-render>

